def f(n):
    if n==1:
        print([1])
    fs=[n]

    while fs[-1]!=1:
        if fs[-1]%2==0:
            a=fs[-1]/2
            fs.append(a)
        else:
            b=fs[-1]*3+1
            fs.append(b)
    return fs

print(f(13))

y1=[]
for x in range(1,1000001):
    z=f(x)
    y=len(f(x))
    y1.append(y)

m=max(y1)
print(m)

for x in range(1,1000001):
    if len(f(x))==m:
        print(f(x))


